package org.jsbd.boss.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.jsbd.boss.dao.ISimulatorGoogleADLogDAO;
import org.jsbd.boss.domian.channel.SimulatorGoogleADLog;
import org.jsbd.boss.domian.channel.SimulatorGoogleADStatistics;
import org.jsbd.boss.service.ISimulatorGoogleADLogService;
import org.jsbd.boss.util.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import edu.hziee.common.queue.DelayExecuteBuffer;

@Service
public class SimulatorGoogleADLogImpl implements ISimulatorGoogleADLogService {
	public static final Logger LOGGER = LoggerFactory.getLogger(SimulatorGoogleADLogImpl.class);

	@Resource(name = "simulatorGoogleADLogBuffer")
	private DelayExecuteBuffer<SimulatorGoogleADLog> simulatorGoogleADLogBuffer;
	@Resource
	private ISimulatorGoogleADLogDAO simulatorGoogleADLogDAO;

	@Override
	public boolean batchInsert(SimulatorGoogleADLog log) {
		log.setCurrentDate(DateUtil.getCurrentDateStr());
		return simulatorGoogleADLogBuffer.add(log);
	}

	@Override
	public List<SimulatorGoogleADStatistics>  getGoogleAD(SimulatorGoogleADStatistics log) {
		return simulatorGoogleADLogDAO.getGoogleADStatistics(log);
	}
}
